home *** CD-ROM | disk | FTP | other *** search
- property constrainChan, constrainPixels, maxChoice, minPos, sliderSprite, currentChoice, increment, slideLoc, numberSprite, totalSprite, playButton, pauseButton, reverseButton
- global gActorList
-
- on birth me, constrChan, firstButChan, maxNum
- set maxChoice to maxNum
- set constrainChan to constrChan
- set sliderSprite to firstButChan
- set reverseButton to firstButChan + 1
- set playButton to firstButChan + 2
- set pauseButton to firstButChan + 3
- set constrainPixels to the right of sprite constrainChan - the left of sprite constrainChan
- set minPos to the left of sprite constrainChan
- repeat with channel in [sliderSprite, reverseButton, playButton, pauseButton]
- puppetSprite(channel, 1)
- end repeat
- set currentChoice to 1
- set increment to 1.0 * constrainPixels / (maxChoice - 1)
- set the constraint of sprite sliderSprite to constrainChan
- return me
- end
-
- on updateSlider me
- set the locH of sprite the clickOn to the mouseH
- set slideLoc to the locH of sprite the clickOn
- set currentPos to slideLoc - minPos
- set currentChoice to integer(1.0 * currentPos / increment) + 1
- end
-
- on snap me
- if currentChoice = maxChoice then
- snapToTop(me)
- else
- if currentChoice = 1 then
- snapToBottom(me)
- else
- snapInMiddle(me)
- end if
- end if
- updateStage()
- end
-
- on snapToBottom me
- set slideLoc to minPos
- moveSlider(me)
- end
-
- on snapToTop me
- set slideLoc to minPos + constrainPixels
- moveSlider(me)
- end
-
- on snapInMiddle me
- set slideLoc to minPos + integer((currentChoice - 1) * increment)
- moveSlider(me)
- end
-
- on moveSlider me
- set the locH of sprite sliderSprite to slideLoc
- end
-
- on dispose me
- set the constraint of sprite sliderSprite to 0
- end
-